using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsClient.Person
{
    public partial class PersonForm : Form
    {
        public PersonForm()
        {
            InitializeComponent();
        }

        private void PersonForm_Load(object sender, EventArgs e)
        {

            GetPersonList();
        }

        private void GetPersonList()
        {
             
        Service.PartyService ps = new Service.PartyService();

        
            
            dgvPerson.DataSource = ps.GetPartyList();
            dgvPerson.DataMember = "Person";
            
        }

        private void SavePersonList()
        {
        }

        private void DataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            string id = e.Row.Cells["PartyID"].FormattedValue.ToString();
            string name = e.Row.Cells["FirstName"].FormattedValue.ToString();
            DialogResult result = MessageBox.Show(
            "Are you sure you want to delete product " + id + " - " + name + "?",
            "Delete?", MessageBoxButtons.OKCancel);
            if (result == DialogResult.Cancel)
            {
                // Cancel the delete operation.
                e.Cancel = true;
            }
        }

        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {

        }

        private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {

        }
    }
}